
-------- 引用次数记录栈 ------------
local stack = {}

stack.__index = stack

function stack:new()
	local instance = {
		data = {}
	}
	setmetatable(instance, stack)
	return instance
end

function stack:insertTop(value)
	local data = self.data
	data[#data + 1] = value
end

function stack:removeTop()
	local data = self.data
	data[#data] = nil
end

function stack:isEmpty()
	local data = self.data
	return #data == 0
end

function stack:clean()
	self.data = {}
end
-------- 引用次数记录栈 ---------